﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace DataManage
{
    public class SecondaryControlSBMUInfo : BaseViewModel
    {
        private ObservableCollection<VCMUInfo> vcmuData;
        public ObservableCollection<VCMUInfo> VCMUData { get => vcmuData; set => vcmuData = value; }

        private ObservableCollection<TCMUInfo> tcmuData;
        public ObservableCollection<TCMUInfo> TCMUData { get => tcmuData; set => tcmuData = value; }

        #region SBMU → VCMU
        private SystemRunState systemRunStatus;
        public SystemRunState SystemRunStatus { get => systemRunStatus; set { systemRunStatus = value; NotifyPropertyChanged(); } }
        private double voltage;
        public double Voltage { get => voltage; set { voltage = value; NotifyPropertyChanged(); } }
        private double current;
        public double Current { get => current; set { current = value; NotifyPropertyChanged(); } }
        private double posHighVoltage;
        /// <summary>
        /// 正极高压
        /// </summary>
        public double PosHighVoltage { get => posHighVoltage; set { posHighVoltage = value;NotifyPropertyChanged(); } }
        private double negHighVoltage;
        /// <summary>
        /// 负极高压
        /// </summary>
        public double NegHighVoltage { get => negHighVoltage; set { negHighVoltage = value; NotifyPropertyChanged(); } }
        private double actualCapacity;
        /// <summary>
        /// 实际容量
        /// </summary>
        public double ActualCapacity { get => actualCapacity; set => actualCapacity = value; }
        private double ratedCapacity;
        /// <summary>
        /// 额定容量
        /// </summary>
        public double RatedCapacity { get => ratedCapacity; set => ratedCapacity = value; }
        private double actualEnergy;
        /// <summary>
        /// 实际能量
        /// </summary>
        public double ActualEnergy { get => actualEnergy; set => actualEnergy = value; }
        private double ratedEnergy;
        /// <summary>
        /// 额定容量
        /// </summary>
        public double RatedEnergy { get => ratedEnergy; set => ratedEnergy = value; }
        private double displaySOC;
        /// <summary>
        /// 显示SOC
        /// </summary>
        public double DisplaySOC { get => displaySOC; set => displaySOC = value; }
        private double usableSOC;
        /// <summary>
        /// 可用SOC
        /// </summary>
        public double UsableSOC { get => usableSOC; set => usableSOC = value; }
        private double realSOC;
        /// <summary>
        /// 真实SOC
        /// </summary>
        public double RealSOC { get => realSOC; set => realSOC = value; }
        private double soe;
        public double SOE { get => soe; set => soe = value; }
        private double soh;
        public double SOH { get => soh; set => soh = value; }
        private double totalInAh;
        /// <summary>
        /// 累积充电总安时
        /// </summary>
        public double TotalInAh { get => totalInAh; set => totalInAh = value; }
        private double totalOutAh;
        /// <summary>
        /// 累积放电总安时
        /// </summary>
        public double TotalOutAh { get => totalOutAh; set => totalOutAh = value; }

        #region 单体电压极值
        private double cellVoltageMax;
        /// <summary>
        /// 单体最大电压
        /// </summary>
        public double CellVoltageMax { get => cellVoltageMax; set => cellVoltageMax = value; }
        private int maxCellVolClusterNo;
        /// <summary>
        /// 最高单体电压簇内编号
        /// </summary>
        public int MaxCellVolClusterNo { get => maxCellVolClusterNo; set => maxCellVolClusterNo = value; }

        private double cellVoltageMin;
        /// <summary>
        /// 单体最小电压
        /// </summary>
        public double CellVoltageMin { get => cellVoltageMin; set => cellVoltageMin = value; }
        private int minCellVolClusterNo;
        /// <summary>
        /// 最小单体电压簇内编号
        /// </summary>
        public int MinCellVolClusterNo { get => minCellVolClusterNo; set => minCellVolClusterNo = value; }
        private double cellDetVoltage;
        /// <summary>
        /// 压差
        /// </summary>
        public double CellDetVoltage { get => cellDetVoltage; set => cellDetVoltage = value; }
        #endregion

        #region 单体温度极值
        private double cellTempMax;
        /// <summary>
        /// 单体最大温度
        /// </summary>
        public double CellTempMax { get => cellTempMax; set => cellTempMax = value; }
        private int maxCellTempClusterNo;
        /// <summary>
        /// 最高单体温度簇内编号
        /// </summary>
        public int MaxCellTempClusterNo { get => maxCellTempClusterNo; set => maxCellTempClusterNo = value; }
     
        private double cellTempMin;
        /// <summary>
        /// 单体最小温度
        /// </summary>
        public double CellTempMin { get => cellTempMin; set => cellTempMin = value; }
        private int minCellTempClusterNo;
        /// <summary>
        /// 最小单体温度簇内编号
        /// </summary>
        public int MinCellTempClusterNo { get => minCellTempClusterNo; set => minCellTempClusterNo = value; }
        #endregion

        private Dictionary<string, RelayStatus> relayInfo;
        /// <summary>
        /// 继电器信息集合
        /// </summary>
        public Dictionary<string, RelayStatus> RelayInfo { get => relayInfo; set { relayInfo = value; NotifyPropertyChanged(); }}

        private Dictionary<string, RelayStatus> dIInfo;
        /// <summary>
        /// DI口、干接点状态、高压互锁、主从DO控制
        /// </summary>
        public Dictionary<string, RelayStatus> DIInfo { get => dIInfo; set { dIInfo = value; NotifyPropertyChanged(); } }
        private double totalBatRes;
        /// <summary>
        /// 电池内阻
        /// </summary>
        public double TotalBatRes { get => totalBatRes; set { totalBatRes = value; NotifyPropertyChanged(); } }

        private DateTime rtc;
        public DateTime RTC { get => rtc; set { rtc = value; NotifyPropertyChanged(); } }
        private Dictionary<string, double> otherInfo;
        /// <summary>
        /// 其他信息
        /// <para>分流器电流</para>
        /// <para>通道1模拟hall电流</para>
        /// <para>通道2模拟hall电流</para>
        /// <para>CAN通信hall电流</para>
        /// <para>最大充电电流</para>
        /// <para>最大放电电流</para>
        /// <para>最大充电功率</para>
        /// <para>最大放电功率</para>
        /// <para>正绝缘电阻</para>
        /// <para>负绝缘电阻</para>
        /// <para>充电口1 CC2</para>
        /// <para>充电口2 CC2</para>
        /// <para>Keyon唤醒</para>
        /// <para>慢充唤醒</para>
        /// <para>快充唤醒</para>
        /// <para>时钟自唤醒</para>
        /// <para>CAN唤醒</para>
        /// <para>快充口01插座正极温度</para>
        /// <para>快充口01插座负极温度</para>
        /// <para>快充口02插座正极温度</para>
        /// <para>快充口02插座负极温度</para>
        /// <para>环境温度1</para>
        /// <para>环境温度2</para>
        /// <para>频率</para>
        /// <para>占空比</para>
        /// </summary>
        public Dictionary<string, double> OtherInfo { get => otherInfo; set { otherInfo = value; NotifyPropertyChanged(); } }
        private List<int> ctrlBalance;
        /// <summary>
        /// 均衡控制指令
        /// </summary>
        public List<int> CtrlBalance { get => ctrlBalance; set { ctrlBalance = value; NotifyPropertyChanged(); } }

        private List<int> actCtrlBalance;
        /// <summary>
        /// 主动均衡控制指令
        /// </summary>
        public List<int> ActCtrlBalance { get => actCtrlBalance; set { actCtrlBalance = value; NotifyPropertyChanged(); } }

        private string softwareVersion;
        /// <summary>
        /// 主板软件版本
        /// </summary>
        public string SoftwareVersion { get => softwareVersion; set { softwareVersion = value; NotifyPropertyChanged(); } }
        private string hardwareVersion;
        /// <summary>
        /// 主板硬件版本
        /// </summary>
        public string HardwareVersion { get => hardwareVersion; set { hardwareVersion = value; NotifyPropertyChanged(); } }

        
        #endregion
    }
}
